package com.cskaoyan.controller;


import com.cskaoyan.bean.collection.AppletCollectListData;
import com.cskaoyan.bean.collection.AppletCollectListVO;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.param.BaseParam;
import com.cskaoyan.service.AppletCollectService;

import com.cskaoyan.util.AuthUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 创建日期: 2022/05/09 09:11
 *
 * @author liutao
 */
@RestController
public class AppletCollectController {

    @Autowired
    AppletCollectService appletCollectService;

    @RequestMapping("wx/collect/list")
    public BaseRespVo collectList(Integer type, BaseParam baseParam) {
        // 假设用户id=1
        // Integer id = 1;
        Integer id = AuthUtils.getUserId();
        AppletCollectListVO appletCollectListVO = appletCollectService.collectList(id, type, baseParam);
        return BaseRespVo.ok(appletCollectListVO);
    }

    @RequestMapping("wx/collect/addordelete")
    public BaseRespVo collectAddordelete(@RequestBody AppletCollectListData appletCollectListData) {
        // 假设用户id=1
        // Integer id = 1;
        Integer id = AuthUtils.getUserId();
        appletCollectService.collectAddordelete(id, appletCollectListData);
        return BaseRespVo.ok(null);
    }

}
